1 <?
2 echo $_SESSION[
"session_message"];
3 $_SESSION[
"session_message"] = "";
4 $MAXPAGE=
20;
5 ?>
6 <table height=
"28" cellSpacing="0" cellPadding="0" width="100%" border="0">
7       <tr align=center>
8         <td
class="title" width="100%">S&#7843;n ph&#7849;m : <a href="./?act=product_m&page=<? echo $page?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nh&#7853;p M&#7899;i</font></a>&nbsp;&nbsp;
9     </td>
10       </tr>
11     </table>
12 <?
13     
switch ($_GET['action'])
14     {
15         
case 'del' :
16             $id = $_GET[
'id'];
17             $pro=GetProductInfo($id);
18             
if ($pro)
19             {
20                 $sql =
"delete from products where id='".$id."'";
21                 $result = mysql_query($sql,$con);
22                 
if ($result)
23                 {
24                     
if (file_exists($pro['image'])) unlink($pro['image']);
25                     
if (file_exists($pro['image_large'])) unlink($pro['image_large']);
26                     mysql_query(
"delete from pro_new where id='".$id."'",$con);
27                     mysql_query(
"delete from pro_good where products_id='".$id."'",$con);
28                     mysql_query(
"delete from pro_saleoff where products_id='".$id."'",$con);
29
30                     echo
"<p align=center class='err'>&#272;ã xóa thành công</p>";
31                 }
32                     
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
33             }
34             
break;
35     }
36 ?>
37
38 <?
39     
if (isset($_POST['ButDel'])) {
40         $cnt=
0;
41         
foreach ($_POST['chk'] as $id)
42         {
43             $pro=GetProductInfo($id);
44             
if ($pro)
45             {
46                 @$result = mysql_query(
"delete from products where id='".$id."'",$con);
47                 
if ($result) {
48                     $cnt++;
49                     
if (file_exists($pro['image'])) unlink($pro['products_image']);
50                     
if (file_exists($pro['image_large'])) unlink($pro['image_large']);
51
52                 }
53             }
54         }
55         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
56     }
57     
if (isset($_POST['ButGood'])) {
58         $cnt=
0;
59         
foreach ($_POST['chk'] as $id)
60         {
61             $pro=GetProductInfo($id);
62             
if ($pro)
63             {
64                 
if (CountRecord("pro_good","products_id=".$pro['products_id'])<=0)
65                 {
66                     $result = mysql_query(
"insert into pro_good (products_id,language,pro_dateadded) values ('".$pro['products_id']."','".$pro['language']."',SYSDATE())",$con);
67                     
if ($result) {
68                         $cnt++;
69                     }
70                 }
71             }
72         }
73         echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t ".$cnt." ph&#7847;n t&#7917;</p>";
74     }
75     
if (isset($_POST['ButNew'])) {
76         $cnt=
0;
77         
foreach ($_POST['chk'] as $id)
78         {
79             $pro=GetProductInfo($id);
80             
if ($pro)
81             {
82                 
if (CountRecord("pro_new","products_id=".$pro['products_id'])<=0)
83                 {
84                     $result = mysql_query(
"insert into pro_new (products_id,language,pro_dateadded) values ('".$pro['products_id']."','".$pro['language']."',SYSDATE())",$con);
85                     
if ($result) {
86                         $cnt++;
87                     }
88                 }
89             }
90         }
91         echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t ".$cnt." ph&#7847;n t&#7917;</p>";
92     }
93     
if (isset($_POST['ButSaleoff'])) {
94         $cnt=
0;
95         
foreach ($_POST['chk'] as $id)
96         {
97             $pro=GetProductInfo($id);
98             
if ($pro)
99             {
100                 
if (CountRecord("pro_saleoff","products_id=".$pro['products_id'])<=0)
101                 {
102                     $result = mysql_query(
"insert into pro_saleoff (products_id,language,pro_dateadded) values ('".$pro['products_id']."','".$pro['language']."',SYSDATE())",$con);
103                     
if ($result) {
104                         $cnt++;
105                     }
106                 }
107             }
108         }
109         echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t ".$cnt." ph&#7847;n t&#7917;</p>";
110     }
111     
112     
if (isset($_POST['trogia'])) {
113         $cnt=
0;
114         
foreach ($_POST['chk'] as $id)
115         {
116             $pro=GetProductInfo($id);
117             
if ($pro)
118             {
119                 @$result = mysql_query(
"update products set trogia=1 where id='".$id."'",$con);
120                 
if ($result) {
121                     $cnt++;
122
123                 }
124             }
125         }
126         echo
"<p align=center class='err'>Đã thêm ".$cnt." sản phẩm trợ giá</p>";
127     }
128     
129         
if (isset($_POST['huytrogia'])) {
130         $cnt=
0;
131         
foreach ($_POST['chk'] as $id)
132         {
133             $pro=GetProductInfo($id);
134             
if ($pro)
135             {
136                 @$result = mysql_query(
"update products set trogia=0 where id='".$id."'",$con);
137                 
if ($result) {
138                     $cnt++;
139
140                 }
141             }
142         }
143         echo
"<p align=center class='err'>Đã hủy ".$cnt." sản phẩm trợ giá</p>";
144     }
145     
146     
147     
148
149
150 ?>
151
152 <?
153     $page = $_GET[
"page"];
154     $p=
0;
155     
if ($page!='') $p=$page;
156     $
where="1=1";
157     
//if ($_REQUEST['status']!='') $where="products_status=".$_REQUEST['status']." ";
158     
if ($_REQUEST['cat']!='') $where="cat=".$_REQUEST['cat'];
159 ?>
160 <form method=
"POST" name="frmList" action="index.php">
161 <input type=hidden name=
"page" value="<? echo $page; ?>">
162 <?
163 function taotrang($total,$link,$nitem,$itemcurrent,$step=
10)
164 {
global $con;
165     $ret=
"";
166     
167     $param=
"";
168     $pages=count_page($total,$nitem);
169     
if ($itemcurrent>0) $ret.='<a title="&#272;&#7847;u tiên" href="'.$link.'0" class="lslink">[&lt;]</a> ';
170     
if ($itemcurrent>1) $ret.='<a title="V&#7873; tr&#432;&#7899;c" href="'.$link.($itemcurrent-1).'" class="lslink">[&lt;&lt;]</a> ';
171     $
from=($itemcurrent-$step>0?$itemcurrent-$step:0);
172     $to=($itemcurrent+$step<$pages?$itemcurrent+$step:$pages);
173     
for ($i=$from;$i<$to;$i++)
174     {
175         
if ($i!=$itemcurrent) $ret.='<a href="'.$link.$i.'" class="lslink">'.($i+1).'</a> ';
176         
else $ret.='<b>'.($i+1).'</b> ';
177     }
178     
if (($itemcurrent<$pages-2) && ($pages>1)) $ret.='<a title="Ti&#7871;p theo" href="'.$link.($itemcurrent+1).'">[&gt;&gt;]</a> ';
179     
if ($itemcurrent<$pages-1) $ret.='<a title="Cu&#7889;i cùng" href="'.$link.($pages-1).'">[&gt;]</a>';
180     
return $ret;
181 }
182
183     $pageindex=taotrang(CountRecord(
"products",$where),"./?act=product&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
184 ?>
185
186 <table cellspacing=
"0" cellpadding="0" width="100%">
187 <?
if ($_REQUEST['code']==1) echo '<tr><td colspan="2" align="center" class="err">&#272;ã c&#7853;p nh&#7853;t thành công</td></tr>'; ?>
188 <tr>
189 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
190 <td height=
"30" align="right" class="smallfont">
191     <
select size="1" name="ddCat" class="smallfont">
192 <?
193     $ms=GetListCat(
17);
194     echo
'<option value="">[T&#7845;t c&#7843;]</option>';
195     
foreach ($ms as $m)
196         
if ($m[0]!=$_REQUEST['cat'])
197             echo
'<option value="'.$m[0].'">'.$m[1].'</option>';
198         
else
199             echo
'<option selected value="'.$m[0].'">'.$m[1].'</option>';
200 ?>
201     </
select>
202     <input type=
"button" value="Chuy&#7875;n" class="button" onclick="window.location='./?act=product&cat='+ddCat.value">
203     </td>
204 </tr>
205 </table>
206
207 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
208   <tr>
209     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
210     <td colspan=
"2" nowrap class="title">&nbsp;</td>
211     <td align=
"center" nowrap class="title"><b>ID</b></td>
212        <td align=
"center" nowrap class="title"><b>Mã </b></td>
213      <td align=
"center" nowrap class="title"><b>Tên </b></td>
214     <td align=
"center" nowrap class="title"><b>Hình nh&#7887;</b></td>
215     <td align=
"center" nowrap class="title"><b>Người đăng</b></td>
216
217     <td align=
"center" nowrap class="title"><b>Th&#7913; t&#7921;</b></td>
218     <td align=
"center" nowrap class="title"><b>Danh m&#7909;c thành viên</b></td>
219 <td align=
"center" nowrap class="title"><b>Danh m&#7909;c hệ thống</b></td>
220 <td align=
"center" nowrap class="title"><b>Trợ giá</b></td>
221 <td align=
"center" nowrap class="title"><b>Ngày đăng</b></td>
222
223   </tr>
224   
225   <?php
226             $sql=
"select * from products where $where and cat_mem!=45 and cat_mem!=46 and trogia=1 order by id limit ".($p*$MAXPAGE).",".$MAXPAGE;
227             $result=mysql_query($sql,$con);
228             $i=
0;
229             
while(($row=mysql_fetch_array($result)))
230             {
231             $i++;
232             
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
233             $catinfo=GetCategoryInfo($row[
'cat_mem']);
234             $cat_system=GetCatInfo($row[
'cat']);
235             $providerinfo=GetProviderInfo($row[
'providers_id']);
236             $donvi=GetDonviInfo($row[
'donvi_id']);
237   ?>
238   
239   <tr>
240     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
241     <input type=
"checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
242     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
243     <a href=
"./?act=product_m&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>&page=<? echo $page?>">S&#7917;a</a></td>
244     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
245     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=product&action=del&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>">Xoá</a></td>
246     <td bgcolor=
"<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['id']; ?>&nbsp;</td>
247      <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['code']; ?>&nbsp;</td>
248     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['name']; ?>&nbsp;</td>
249     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['image']; ?>&nbsp;</td>
250     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['user']; ?>&nbsp;</td>
251     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['thutu']; ?>&nbsp;</td>
252     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $catinfo['name']; ?>&nbsp;</td>
253     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $cat_system['name']; ?>&nbsp;</td>
254     <td bgcolor=
"<? echo $color; ?>" class="smallfont">
255     <?
if($row['trogia']=='1')
256     {?>
257     <font color=
"blue"><b>Có</b></font>
258     <?}
else{?>
259     <font color=
"red"><b>Không</b></font>
260     <?}?>
261     </td>
262     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['date']; ?>&nbsp;</td>
263
264   </tr>
265   <?
266                 }
267   ?>
268 </table>
269 <input type=
"hidden" name="act" value="product"><table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
270     <tr>
271         <td>
272 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button"></td>
273         <td align=
"right">
274 <input type=
"submit" value="Sản phẩm trợ giá" name="trogia" class="button">
275 <input type=
"submit" value="Hủy sản phẩm trợ giá" name="huytrogia" class="button"></td>
276 <td align=
"right">
277 &nbsp;&nbsp;&nbsp;
278 </td>
279
280
281     </tr>
282 </table>
283 </form>
284 <script language=
"JavaScript">
285 function chkallClick(o) {
286     
var form = document.frmList;
287     
for (var i = 0; i < form.elements.length; i++) {
288         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
289             form.elements[i].
checked = document.frmList.chkall.checked;
290         }
291     }
292 }
293 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.935 lượt xem

Gõ tìm kiếm nhanh...